include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-chinadns
PKG_VERSION:=1.0
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

define Package/luci-app-chinadns
SECTION:=LuCI
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI Support for chinadns
DEPENDS:=+chinadns
PKGARCH:=all
endef

define Package/luci-app-chinadns/description
LuCI Support for chinadns
endef

define Build/Compile
endef

define Package/luci-app-chinadns/postinst
#!/bin/sh
( . /etc/uci-defaults/luci-chinadns ) && rm -f /etc/uci-defaults/luci-chinadns
exit 0
endef

define Package/luci-app-chinadns/postrm
#!/bin/sh
uci -q batch <<-EOF >/dev/null
	delete ucitrack.@chinadns[-1]
	commit ucitrack
EOF
rm -f /tmp/luci-indexcache
rm -rf /tmp/luci-modulecache
exit 0
endef

define Package/luci-app-chinadns/install
	$(CP) ./root/* $(1)
	$(INSTALL_DIR) $(1)/etc/uci-defaults
	$(INSTALL_BIN) ./files/luci-chinadns.uci $(1)/etc/uci-defaults/luci-chinadns
endef

$(eval $(call BuildPackage,luci-app-chinadns))
